package com.qisimanxiang.dalaran.sentinel.web;

import com.qisimanxiang.dalaran.sentinel.web.request.UserUpdateRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;
import java.util.UUID;

@RestController
@RequestMapping("/user")
public class UserController {

    Random random = new Random();

    @RequestMapping("/create")
    public String create() throws InterruptedException {
        Thread.sleep(random.nextInt(60));
        return UUID.randomUUID().toString();
    }

    @PostMapping("/update")
    public String update(@RequestBody UserUpdateRequest request) {
        return request.toString();
    }
}
